package org.hw;/*
 *@Author: gjh
 *Date: 2025/3/18 11:14
 *Describe:
 */

import java.lang.reflect.Field;
import java.util.ArrayList;

public class SqlGenerate {
    public static String generateSelect(Class<?> clz){
        // 获取类名
        String tableName = clz.getSimpleName();

        // 获取字段
        Field[] fields = clz.getDeclaredFields();

        ArrayList<String> list = new ArrayList<>();

        // 提取字段名称
        for (Field field : fields) {
            list.add(field.getName());
        }

        System.out.printf("select * from %s where %s = ? and %s = ?",tableName,list.get(0),list.get(1));
        return null;
    }
}
